package group.hhsw.purchase.service.impl;

import group.hhsw.feign.clients.ProductClient;
import group.hhsw.purchase.service.PurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class PurchaseContext {

    @Autowired
    private ProductClient productClient;

    //根据id获取不同的原子服务
    @Autowired
    private Map<String, PurchaseService> purchaseServiceMap;

    public PurchaseService getAtomicService(String id) {
        return purchaseServiceMap.get(id);
    }

    public String getProService(String id) {
        return  productClient.getProService(id);
    }
}
